<%@ taglib prefix="from" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>

<script>
    function saveSkinTest(url,divUrl){
        var skinResult = $("#contentTable .table-selected").find("select option:checked").val();
        $.ajax({
            url:url+"&skinResult="+skinResult,
            success:function(data){
                toastr.success(data.data);
                loadDiv("mainCenterDiv", divUrl);
            }

        })
    }
</script>
<section class="panel" style="height: 100%">
    <div class="panel-body">
        <div class="table-responsive no-border">
            <div class="datatable-top">
                <div class="pull-left">
                    <form:form id="searchForm" modelAttribute="outpTreatPresc"  onsubmit="return loadDivForm('mainCenterDiv','searchForm','${ctx}/OutpTreatPresc/OutpTreatPresc/index');" method="post" class="form-inline">
                        <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                        <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                        <label>门诊号 ：</label><form:input path="clinicMaster.id" htmlEscape="false" maxlength="50"
                                                        class="form-control"/> &nbsp;&nbsp;&nbsp;
                        <label>患者姓名 ：</label><form:input cssStyle="width: 100px;" path="patMasterIndex.name"
                                                         htmlEscape="false" maxlength="50"
                                                         class="form-control"/> &nbsp;&nbsp;&nbsp;
                        <label>性别 ：</label>
                        <form:select cssStyle="width: 100px;" path="patMasterIndex.sex" maxlength="50"
                                     class="form-control">
                            <from:option value="" label=""/>
                            <form:options items="${fns:getDictList('SEX_DICT')}" htmlEscape="false" itemLabel="label"
                                          itemValue="value"/>
                        </form:select>
                        &nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                    </form:form>
                </div>
            </div>
            <div id="tableDiv">
            <table id="contentTable" class="table table-bordered mg-t datatable">
                <thead>
                <tr>
                    <td style="display: none">recId</td>
                    <td style="display: none">prescId</td>
                    <th>门诊号</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>皮试项目</th>
                    <th>结果</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${page.list}" var="list">
                <tr>
                    <td style="display: none">${list.treatId}</td>
                    <td style="display: none">${list.prescId}</td>
                    <td>${list.patMasterIndex.name}</td>
                    <td>${list.clinicMaster.clinicNo}</td>
                    <td>${fns:getDictLabels(list.patMasterIndex.sex,'SEX_DICT','' )}</td>
                    <td>${list.drugName}</td>
                    <td><sys:select name="skinResult" checkValue="${list.skinResult}"
                                    lists="${fns:getDictList('SKIN_TEST_RESULT')}"
                                    className="form-control"></sys:select>
                    </td>
                    <td>
                        <c:if test="${list.skinResult eq null || list.skinResult == ''}">
                            <a href="#"
                               class="btn btn-warning btn-xs"
                               onclick="confirmExtend('确定要保存吗？',function(){saveSkinTest('${ctx}/OutpTreatPresc/OutpTreatPresc/updateResult?id=${list.id}','${ctx}/OutpTreatPresc/OutpTreatPresc/index?id=${list.id}')})">保存</a></td>
                        </c:if>
                        <c:if test="${list.skinResult != null || list.skinResult !=''}">
                            以保存
                        </c:if>

                </tr>
                </c:forEach>
                <tbody>
            </table>
            <div class="pagination">${page}</div>
        </div>
        </div>
    </div>
</section>
